package com.zl.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.aop.ThrowsAdvice;
import org.springframework.stereotype.Component;

/**
 * @author ZLL
 * @date create in 2018/05/09
 */


@Aspect
@Component
public class CatchException implements ThrowsAdvice {

    @AfterThrowing(
            pointcut = "execution(* com.zl.aop.service2.MyBizService.*(..))",
            throwing = "ex")
    public void afterThrowing(JoinPoint joinPoint, Exception ex) throws Throwable {
        System.out.println("Inside CatchThrowException.afterThrowing() method...");
        System.out.println("Running after throwing exception...");
        System.out.println("Exception : " + ex);
    }
}
